home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / news / thor / rexx / purgeevents.thor < prev    next >
Text File  |  1998-05-24  |  2KB  |  85 lines

  1. /* PurgeEvents.thor by Troels Walsted Hansen
  2. ** $VER: PurgeEvents.thor 1.3 (3.12.94)
  3. **
  4. ** Remove all events at one BBS in THOR.  Useful when testing
  5. ** event creating scripts.  :)
  6. **
  7. ** History:
  8. ** PurgeEvents.thor v1.21 (19.11.94)
  9. **  · Works with THOR v2.0.
  10. **
  11. ** PurgeEvents.thor v1.30 (03.12.94)
  12. **  · removed obsolete code
  13. **  · will now remove all events no matter *what*
  14. **    use with caution! :^)
  15. */
  16.  
  17. options results
  18.  
  19. /* needs THOR and bbsread.library functions */
  20.  
  21. p = ' ' || address() || ' ' || show('P',,)
  22. thorport = pos(' THOR.',p)
  23.  
  24. if thorport > 0 then thorport = word(substr(p,thorport+1),1)
  25. else
  26. do
  27.     say 'No THOR port found!'
  28.     exit 10
  29. end
  30.  
  31. if ~show('p', 'BBSREAD') then
  32. do
  33.     address command
  34.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  35.         "WaitForPort BBSREAD"
  36. end
  37.  
  38. address(thorport)
  39.  
  40. CURRENTBBS stem CURRENT
  41. if(rc ~= 0 | CURRENT.BBSNAME ~= "") then bbs = CURRENT.BBSNAME
  42. else exit
  43.  
  44. REQUESTNOTIFY TEXT '"'||'Do you really want to delete\nall events at '||bbs||?'"' BT '"_No|_Yes"'
  45. if(result = 1) then exit
  46.  
  47. /* mark all events as deleted */
  48.  
  49. address(bbsread)
  50.  
  51. GETBBSDATA '"'bbs'"' stem BBSDATA
  52. if(rc ~= 0) then
  53. do
  54.     address(thorport)
  55.     REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  56.     exit 5
  57. end
  58.  
  59. do i=BBSDATA.FIRSTEVENT to BBSDATA.LASTEVENT
  60.     UPDATEBREVENT BBSNAME '"'bbs'"' EVENTNR i SETDELETED
  61.     if(rc ~= 0) then
  62.     do
  63.         address(thorport)
  64.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  65.         exit 5
  66.     end
  67. end
  68.  
  69. /* tell bbsread.library to remove the marked events permanently */
  70.  
  71. PACKDATAFILE BBSNAME '"'bbs'"' EVENTDATA /*SHOWPROGRESS*/
  72. if(rc ~= 0) then
  73. do
  74.     address(thorport)
  75.     REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  76.     exit 5
  77. end
  78.  
  79. /* update THOR's startupwindow-bbslist-flags */
  80.  
  81. address(thorport)
  82. RESCAN
  83.  
  84. exit
  85.